﻿using System.Collections.Generic;
using Newtonsoft.Json;

namespace T.FAS.Runtime.Metadata.Entity.MF
{
    public class CdoNode : NodeBase
    {
        [JsonProperty("data")]
        public new CdoNodeData Data { get; set; }
        [JsonIgnore]
        public override string RefMetaDataID
        {
            get
            {
                return Data.CdoID;
            }
        }
        [JsonIgnore]
        public override string RefMetaDataType
        {
            get
            {
                return "cdo";
            }
        }
    }

    public class CdoNodeData
    {
        [JsonProperty("label")]
        public string Label { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("cdoId")]
        public string CdoID { get; set; }
        [JsonProperty("cdoName")]
        public string CdoName { get; set; }
        [JsonProperty("cdoCode")]
        public string CdoCode { get; set; }
        [JsonProperty("operation")]
        public OperationNodeData Operation { get; set; }
        [JsonProperty("outputFields")]
        public List<CDOOuputField> OutputVariables { get; set; }
        [JsonProperty("error_strategy")]
        public string ErrorStrategy { get; set; }

        [JsonProperty("default_value")]
        public List<UserVariable> DefaultValues { get; set; }
    }
    public class OperationNodeData
    {
        [JsonProperty("params")]
        public Dictionary<string, object> Params { get; set; }

        [JsonProperty("code")]
        public string Code { get; set; }

        [JsonProperty("funcSign")]
        public string FuncSign { get; set; }

        [JsonProperty("metaData")]
        public MetaDataNodeData MetaData { get; set; }
    }

   
    public class MetaDataNodeData
    {
        [JsonProperty("ID")]
        public string ID { get; set; }

        [JsonProperty("DisplayName")]
        public string DisplayName { get; set; }

        [JsonProperty("Name")]
        public string Name { get; set; }
        [JsonProperty("Code")]
        public string Code { get; set; }

        [JsonProperty("Description")]
        public string Description { get; set; }

        [JsonProperty("ItemType")]
        public string ItemType { get; set; }
        [JsonProperty("ValueType")]
        public string ValueType { get; set; }
        [JsonProperty("ExprFuncItemParamList")]
        public List<ExprFuncItemParamNodeData> ExprFuncItemParamList { get; set; }
    }

    public class ExprFuncItemParamNodeData
    {
        [JsonProperty("ID")]
        public string ID { get; set; }

        [JsonProperty("Name")]
        public string Name { get; set; }

        [JsonProperty("Code")]
        public string Code { get; set; }

        [JsonProperty("DataType")]
        public int DataType { get; set; }

        [JsonProperty("IsEmpty")]
        public string IsEmpty { get; set; }
        [JsonProperty("DefaultValue")]
        public string DefaultValue { get; set; }
        [JsonProperty("ExprExt")]
        public string ExprExt { get; set; }
    }

    public class CDOOuputField
    {

        [JsonProperty("variable")]
        public string Variable { get; set; }

        [JsonProperty("type")]
        public string Type { get; set; }

        [JsonProperty("label")]
        public string Label { get; set; }
    }
}
